<?php

class DateUtil {
	
	public static $EN_US = "Y-m-d";
	public static $PT_BR = "d/m/Y";
	
	private static $SEPARATOR = array();
	
	private static function loadSeparator() {
		if( count( self::$SEPARATOR ) == 0 ){
			$api = new ReflectionClass("DateUtil");
			$properties = $api->getStaticProperties();
			foreach ($properties as $name => $value){
				$key = "$value";
				self::$SEPARATOR[ $key ] = substr( $key, 1, 1 );
			}
		}
	}
	
	public static function convertDate($strDate, $from, $to) {
		self::loadSeparator();
		$date = explode( self::$SEPARATOR[$from] , $strDate );
		$mask = explode( self::$SEPARATOR[$from] , $from );
		for ($i = 0; $i < count($date); $i++) 
			$to = str_replace($mask[$i], $date[$i], $to);
		return $to;
	}

}

?>